package com.colin.app.fragment.mine;


import android.os.Bundle;
import android.view.View;

import com.colin.app.R;
import com.colin.app.app.AppActivity;
import com.colin.app.app.AppFragment;


public class MineFragment extends AppFragment implements MineContract.MineView, View.OnClickListener {
    private MineContract.MinePresenter mMinePresenter = null;
    private static final String FRAGMENT_ID = "fragment_id";
    private int fragment_id;

    public static MineFragment newInstance(AppActivity mAppActivity, int fragment_id) {
        activity = mAppActivity;
        MineFragment fragment = new MineFragment();
        Bundle bundle = new Bundle();
        bundle.putInt(FRAGMENT_ID, fragment_id);
        fragment.setArguments(bundle);
        return fragment;
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle = getArguments();
        fragment_id = bundle.getInt(FRAGMENT_ID);
    }

    @Override
    public void onDestroyView() {
        if (null!=mMinePresenter){
            mMinePresenter.destroy();
            mMinePresenter = null;
        }
        super.onDestroyView();
    }

    @Override
    public void initPresenter() {
        mMinePresenter = new MinePresenterImpl((AppActivity) activity, this);
    }


    @Override
    public int initViewLayoutID() {
        return R.layout.fragment_mine;
    }

    @Override
    public void initView() {

    }

    @Override
    public void initListener() {
        this.getView().findViewById(R.id.button_mine_login).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.button_mine_login:
                mMinePresenter.toLoginActivity();
                break;
        }
    }


}
